<div class="_topinfo">
    {{#if bus_info.config.home_imgs.length}}
    <picwall array-data-key="bus_info.config.home_imgs"></picwall>
    {{/if}}

    <div class="storeinfo">
        <div class="logo">
            <img src="{{bus_info.info.logo_url}}?imageView/1/w/150">
        </div>
        <div class="storename">{{bus_info.info.title}}</div>
    </div>
</div>
<div class="mainbox">
{{#include "/pages/mobile/index/nav.html"}}
{{#if $Cache.tags_detail.length}}
{{#each $Cache.tags_detail}}
    {{#if $Index < 5}}
        <div class="eachtag">
        <div class="tagtitle">
            {{tag_name}}
        </div>
            {{#if detail_content.length}}
                {{#each detail_content}}
                {{#if $Index < 4}}
                <egoodsitem
                    href="{{_id}}"
                    src="{{preview_img_url}}"
                    goodsname="{{goods_name}}"
                    price="{{price+'/'+unit}}"
                ></egoodsitem>
                {{/if}}
                {{/each}}
            {{#else}}
            <p>此分类下没有商品</p>
            {{/if}}
        </div>
    {{/if}}
{{/each}}
{{#else}}
    <div class="eachtag">
        {{#if goods_list.length}}
        {{#each goods_list}}
        <egoodsitem
            href="{{_id}}"
            src="{{preview_img_url}}"
            goodsname="{{goods_name}}"
            price="{{price+'/'+unit}}"
        ></egoodsitem>
        {{/each}}
        {{#else}}
        <p>该店铺还没有上传商品</p>
        {{/if}}
    </div>
{{/if}}
</div>
<div class="getmore">
    {{#if loadingoods}}
    <p>正在加载</p>
    {{#else}} 
    <a href="#default/goods_list">
        <button>查看更多商品</button>
    </a>
    {{/if}}
</div>

<xmp type="tag" name="egoodsitem">
    <a href="#default/goods_details?id=${href}">
        <div class="goodsitem">
            <img bind-src="${src}?imageView/1/w/150" />
            <div class="goodsinfo">
                <div class="item">${goodsname}</div>
                <div class="item">
                    <span class="price">￥${price}</span>
                </div>
            </div>
        </div>
    </a>
    <script type="text/vm">
    function(vm){
        var goodsitem=vm.queryElement({
            className:"goodsitem"
        })[0];
        require(["jQuery"], function() {
            if ($(document).width() > 500) {
                $(goodsitem).css({
                    'width': '31%'
                });
            };
        })
    }
    </script>
</xmp>


<xmp type="tag" name="picwall">
    <div class="picwall">
        <div class="carosule">
            <div class="pic-show">
                {{#each ${array-data-key} }}
                <div style="z-index:{{$Parent.length-$Index}}" class="pic">
                    <a target="_blank" bind-href="{{href||'javascript:void 0'}}">
                        <img bind-src="{{img_url}}" bind-title="{{title}}" />
                    </a>
                </div>
                {{/each}}
            </div>
        </div>
    </div>
    <script type="text/vm">
        function(vm) {
            var picwall = vm.queryElement({
                className: 'picwall'
            })[0];
            var img = vm.queryElement({
                tagName: "IMG"
            });
            require(["jQuery"], function($) {
                var w = $(picwall).width();
                $(picwall).height(w * 0.284);
                var current_pic;
                setInterval(function _a() {
                    var pics = $(".pic");
                    current_pic || (current_pic = pics.first());
                    var animating_pic = current_pic.fadeOut(800);
                    current_pic = current_pic.next();
                    if (current_pic.length == 0) {
                        current_pic = null;
                        pics.not(animating_pic).fadeIn(800);
                        setTimeout(function() {
                            animating_pic.fadeIn();
                        }, 800);
                    };
                    return _a;
                }(), 3500);
            });
        }
    </script>
</xmp>

